<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="/struts-tags" prefix="s" %>
<%@taglib uri="/struts-dojo-tags" prefix="sx" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Buy Book </title>
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>

<script type="text/javascript">
var ajaxOptions = 'category_id=<s:property value="book.category_id"/>&subcategory_id=<s:property value="book.subcategory_id"/>&product_id=<s:property value="book.product_id"/>&seller_id=<s:property value="book.seller_id"/>';
$(document).ready(function() {
	$('a.cart').click(function(e) {
		//alert("here");
		e.preventDefault();
		var quan = document.getElementById("quantity").value;
		//alert(""+quan);
		$.ajax({
			type: 'get',
			url: 'addToCart',
			data: 'ajax=1&' + ajaxOptions +'&quantitypurchased='+quan ,
			beforeSend: function() {
				
			},
			cache: false,
			success: function() {
				$('a.cart').hide(1);
			}
		});
	});
});

</script>

<style type="text/css">

.d{width: 750; height: 1000}</style>


<style type="text/css">
#search
{
	background-color: #0431B4; 
	
	color: white; font-family: arial, verdana, ms sans serif;
	 font-weight:bold;
	  font-size: 12pt;
	   text-align: right;
	   -moz-border-radius: 8px;
   	-webkit-border-radius: 8px;
}

#list
{

 border: 1px solid black;
 
}

#list td
{

 border: 1px solid black;

}

#list th
{

 border: 1px solid black;

}



#footer {
    border-top: 1px solid #000;
    height: 20px;
    top:90%;
    font-size:10px;
}





a { color:#08088A;
text-decoration:none;
 }
 a:visited { color: #08088A; }
 a:hover { color: #6A0888; }
 a:active { color: #08088A; }
 
 
#menu1
{
background-color: #E6E6E6;
width:100%;
}



#tbl1
{
 	padding: 20px;
	background-color:#E6E6E6;
	width:100%;
}



#footer {
    border-top: 1px solid #000;
    height: 20px;
    top:90%;
    font-size:9px;
}


#tblmenu
{
 border: 1px solid #E6E6E6;
 width:40%;
}


#tblbrowse
{
 border: 1px solid #E6E6E6;
	
}


#image
{
 border: 1px solid #E6E6E6;
	
}



#tbllist
{
 border: 1px solid #E6E6E6;
 width:100%;
}


</style>
<sx:head/>

</head>
<body>

<%@ include file="/jsp_pages/account/header.jsp" %><br/>
<br>
<h4>Books</h4>
<hr width="100%">

<table width="100%" >

<s:iterator value="lstbooks">

<tr><td width="15%" id="image"><img src="<s:property value="image" />" width="100%" height="300"/>
<td width="70%">
<table width="100%">
	<tr><td   colspan="2" align="center" width="20%" valign="top"><s:property value="title"/><td>
	<tr><td colspan="2" width="100%"><hr width="100%"/>
	<tr><td valign="top">Item Condition: 
	<b><s:property value="cond"/></b>
	<td></td>

	<tr><td width="50%">
	<tr><td colspan="2">
	<s:if test="biddingstatus">
		<form action="placeBid">
		<input type="hidden" name="product_id" value="<s:property value="product_id" />">
		<table width="50%" bgcolor="#E6E6E6">
			<tr><td>Time Left : <td><s:property value="timeLeft"/> (<s:property value="endTime"/>)
			<tr><td>Starting Bid : <td>Rs.<s:property value="startBid"/>
			<tr><td>Your Bid : <td>Rs.<input type="text" name="bidAmount"/>
			<tr><td><input type="submit" value="Place Bid"/><td>(Enter amount greater than Rs.<s:property value="startBid"/>)</tr>
		</table>
		</form>
	</s:if>
		<s:else>
		<form action="buyNow">
		<input type="hidden" name="product_id" value="<s:property value="product_id" />">
		<table width="50%" bgcolor="#E6E6E6">
			<tr><td>Price : <td><s:property value="price"/>
			<tr><td>Quantity : <td>Rs.<input type="text" id="quantity" value="1" name="quantitypurchased"/>
			<tr><td><input type="submit" value="Buy Now"/><td>
			<s:url id="addtocartUrl" action="addToCart"/>
			<a href="<s:property value="addtocartUrl" />" class="cart">add to cart</a></tr>
		</table>
		</form>
		</s:else>
	</table>
	<table>
		<tr>
		<td>Shipping
		<td>Read item description or Contact seller
		</tr>
		<tr>
		<td>Delivery
		<td> Varies
		</tr>
		<tr>
		<td>Payments
 		<td>
 		<tr>
 		<td>Returns
		<td>
	</table>
	</td>
	</tr>
</s:iterator>
</table>


<br/>
<br/>
<br/>
<br/>
<br/>
<form>


<sx:tabbedpanel id="text" cssClass="d">

<sx:div id="bookdescription" label="Description" cssClass="d">
<s:iterator value="lstbooks">
Title:<s:property value="title"/><br/>
Description:<s:property value="description"/><br/>
Price:<s:property value="price"/><br/>
Condition:<s:property value="cond"/><br/>
No of pages:<s:property value="pages"/><br/>
Author:<s:property value="author"/><br/>
Publisher:<s:property value="publisher"/><br/>
Language:<s:property value="lang"/><br/>
</s:iterator>
</sx:div>

<sx:div id="bookshipping" label="Shipping and Payment" >

</sx:div>

</sx:tabbedpanel>
</form>
</body>

</html> 
